home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Mac Game Programming Gurus
/
TricksOfTheMacGameProgrammingGurus.iso
/
More Source
/
C⁄C++
/
Kant Generator Pro 1.2
/
src
/
Shell ƒ
/
edit functions.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-31
|
3KB
|
111 lines
#include "edit functions.h"
#include "drag utilities.h"
#include "text twiddling.h"
#include "window layer.h"
void GenericCut(WindowPtr theWindow)
{
TEHandle hTE;
ControlHandle vScrollBar;
hTE=GetWindowTE(theWindow);
vScrollBar=GetWindowVScrollBar(theWindow);
if (AnyHighlightedQQ(theWindow))
SetWindowIsModified(theWindow, TRUE);
TECut(hTE);
ZeroScrap();
TEToScrap();
if (vScrollBar!=0L)
AdjustForEndScroll(vScrollBar, hTE);
TESelView(hTE);
if (vScrollBar!=0L)
AdjustVScrollBar(vScrollBar, hTE);
SetWindowLastFindPosition(theWindow, (**hTE).selStart);
ResetHiliteRgn(theWindow);
}
void GenericCopy(WindowPtr theWindow)
{
TEHandle hTE;
ControlHandle vScrollBar;
hTE=GetWindowTE(theWindow);
vScrollBar=GetWindowVScrollBar(theWindow);
TECopy(hTE);
ZeroScrap();
TEToScrap();
TESelView(hTE);
if (vScrollBar!=0L)
AdjustVScrollBar(vScrollBar, hTE);
SetWindowLastFindPosition(theWindow, (**hTE).selStart);
ResetHiliteRgn(theWindow);
}
void GenericPaste(WindowPtr theWindow)
{
TEHandle hTE;
ControlHandle vScrollBar;
Handle scrapHandle;
long dummy;
unsigned long scrapLength;
hTE=GetWindowTE(theWindow);
vScrollBar=GetWindowVScrollBar(theWindow);
scrapHandle=NewHandle(0L);
if (GetScrap(scrapHandle, 'TEXT', &dummy)!=noTypeErr)
{
scrapLength=GetHandleSize(scrapHandle);
if (scrapLength+(**hTE).teLength>32767)
{
SysBeep(7);
return;
}
if (scrapLength!=0L)
SetWindowIsModified(theWindow, TRUE);
TEFromScrap();
TEPaste(hTE);
TESelView(hTE);
if (vScrollBar!=0L)
AdjustVScrollBar(vScrollBar, hTE);
}
DisposeHandle(scrapHandle);
SetWindowLastFindPosition(theWindow, (**hTE).selStart);
ResetHiliteRgn(theWindow);
}
void GenericClear(WindowPtr theWindow)
{
TEHandle hTE;
ControlHandle vScrollBar;
hTE=GetWindowTE(theWindow);
vScrollBar=GetWindowVScrollBar(theWindow);
if (AnyHighlightedQQ(theWindow))
SetWindowIsModified(theWindow, TRUE);
TEDelete(hTE);
if (vScrollBar!=0L)
AdjustForEndScroll(vScrollBar, hTE);
TESelView(hTE);
if (vScrollBar!=0L)
AdjustVScrollBar(vScrollBar, hTE);
SetWindowLastFindPosition(theWindow, (**hTE).selStart);
ResetHiliteRgn(theWindow);
}
void GenericSelectAll(WindowPtr theWindow)
{
TEHandle hTE;
ControlHandle vScrollBar;
hTE=GetWindowTE(theWindow);
vScrollBar=GetWindowVScrollBar(theWindow);
TESetSelect(0, 32767, hTE);
TESelView(hTE);
if (vScrollBar!=0L)
AdjustVScrollBar(vScrollBar, hTE);
SetWindowLastFindPosition(theWindow, (**hTE).selStart);
ResetHiliteRgn(theWindow);
}